package com.hzhjhh.view.cashierView;

import javax.swing.JButton;

import com.hzhjhh.view.loginView.Admin;

/**
 * 组件初始化-收银页面-前台转后台
 * @author 12083
 *
 */
public class Front2BackInit {

	/**
	 * 初始化前台转后台-按钮
	 */
	public static JButton initBt(VenditionDialog venditionDialog) {
		JButton front2Back = new JButton();
		front2Back.setBounds(560, 489, 96, 25);
		// 设置提示信息
//		front2Back.setToolTipText("");
		front2Back.setText("前台转后台");
		front2Back.addActionListener(event -> {
			if (venditionDialog.isAdminInitFlag()) {
				// 初始化过，就不用再初始化了
				return;
			}
			Admin admin = new Admin(venditionDialog);
//			admin.setVisible(true);
//			admin.setLocation(200, 200);
//			adminInitFlag = true;
			venditionDialog.setAdminInitFlag(true);
			venditionDialog.setVisible(false);
		});
		return front2Back;
	}
}
